{include file="public/header" /}
<body>
<style>
    .cion{
        display: inline-block;
        width: 120px;
    }
</style>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 商品管理
    <span class="c-gray en">&gt;</span> 订单列表
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="/good/order_sell" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <form  method="get" action="">
        <div class="text-c">

            <input type="text" class="input-text" style="width:250px" placeholder="买卖账号|订单号|接盘订单" value="{:input('word')}" name="word">

            <span class="select-box" style="width: 100px;">
                <select name="order_status" class="select">
                    <option value="0">是否支付</option>
                    <option value="1" {if isset($_GET['order_status']) && $_GET['order_status'] == 1}selected{/if}>待支付</option>
                    <option value="2" {if isset($_GET['order_status']) && $_GET['order_status'] == 2}selected{/if}>已完成</option>
                    <option value="3" {if isset($_GET['order_status']) && $_GET['order_status'] == 3}selected{/if}>其他</option>
                </select>

            </span>
            <span class="select-box" style="width: 100px;">
                <select name="gid" class="select">
                    <option value="0">全部商品</option>
                    {foreach $goods as $v}
                        {if isset($_GET['gid']) && $v.id ==  $_GET['gid']}
                        <option value="{$v.id}" selected>{$v.name}</option>
                        {else/}
                        <option value="{$v.id}">{$v.name}</option>
                        {/if}
                    {/foreach}
                </select>
            </span>
            <button type="submit" class="btn btn-success">搜索</button>
        </div>
    </form>

    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
        </span>
        <span class="r">共有数据：<strong>{$list->total()}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-hover table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="11">系统支付列表</th>
        </tr>
        <tr class="text-c">
            <th width="30">id</th>
            <th width="100">订单号</th>
            <th width="100">用户</th>
            <th width="80">类型</th>
            <th width="150">商品</th>
            <th width="80">创建时间</th>
            <th width="80">支付时间</th>
            <th width="150">接盘人</th>
            <th width="80">接盘订单</th>
            <th width="50">状态</th>
            <th width="100">操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $v}
        <tr class="text-c">
            <td>{$v.id}</td>
            <td>{$v.sell_sn}</td>
            <td>{$v.sell_user_name}-{$v.sell_mobile}</td>
            <td>{switch name="$v.sell_type"}
                {case value="1"}平台放单{/case}
                {case value="2"}换购订单{/case}
                {case value="3"}用户订单{/case}
                {default /}--
                {/switch}
                ：
                {switch name="$v.froce"}
                {case value="1"}强制匹配{/case}
                {case value="0"}系统匹配{/case}
                {default /}--
                {/switch}
            </td>

            <td>{$v.sell_gname}-(mt:{$v.sell_mt}-收益:{$v.sell_day_profit})/{$v.sell_days}天</td>
            <td>{$v.create_time}</td>
            <td>{$v.pay_time}</td>
            <td>{if $v.buy_id == 0}
                  系统:
                {else/}
                用户
                {/if}
                {$v.buy_name}: {$v.buy_user_name}
            </td>
            <td>{$v.sell_next_sn}</td>
            <td>{switch name="$v.order_status"}
                {case value="1"}待支付{/case}
                {case value="2"}待确认{/case}
                {case value="3"}已完成{/case}
                {case value="4"}取消{/case}
                {case value="5"}申述中{/case}
                {case value="6"}申述成功{/case}
                {case value="7"}判定{/case}
                {default /}--
                {/switch}</td>
            </td>
            <td>
                {if $v.order_status==1}
                <span class="btn btn-link" title="订单支付" href="javascript:;" onclick="layopen('订单支付','{:url('order_pay_admin',['id'=>$v.id])}',800,700)">支付</span>
                {/if}
                <span class="btn btn-link" title="订单详情" href="javascript:;" onclick="layopen('订单详情','{:url('order_detail',['id'=>$v.id])}',800,700)">详情</span>
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    <div class="page">
        {$list->render()|raw}
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">

    function order_comfirt(obj,id){
        var info = '确认要 确认订单吗，操作后此订单将完成';
        layer.confirm(info,function(index){
            $.ajax({
                type: 'POST',
                url: "{:url('order_comfirt')}",
                data: {id:id},
                dataType: 'json',
                success: function(data){
                    if(data.status == 'y'){
                        layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                            location.replace(location.href);
                        });
                    }else{
                        layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

    function order_cancle(obj,id){
        var info = '确认要 取消订单吗，操作后此订单将重新售卖,并将冻结买家';
        layer.confirm(info,function(index){
            $.ajax({
                type: 'POST',
                url: "{:url('order_cancle')}",
                data: {id:id},
                dataType: 'json',
                success: function(data){
                    if(data.status == 'y'){
                        layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                            location.replace(location.href);
                        });
                    }else{
                        layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
</script>